<template>
	<view :style="{'--color':vuex_config.themeColor1}">
		<view class="hist_item" v-for="(item,index) in dataList" :key="index" @click="seeDetail(item)">
			<view class="top">
				<view class="name">{{item.uname || item.name}}</view>
				<view v-if="parameter.examine == 1" :class="['sign',item.status == 2 ?'success':'']">
					{{statusObj[item.status]}}
				</view>
				<view v-else-if="item.sign_in == 1" :class="['sign',item.sign_in_time?'success':'']">
					{{item.sign_in_time?'已签到':'未签到'}}
				</view>
			</view>
			<view class="phone" v-if="item.phone?true:false">{{item.phone}}</view>
			<view class="sign_tiem" v-if="item.sign_in_time?true:false">签到时间：<text
					class="time">{{item.sign_in_time | formatTime}}</text></view>
			<view class="sign_tiem">报名时间：<text class="time">{{item.date_creation | formatTime}}</text></view>
		</view>

		<view class="fix_bot_main">
			<view class="fixed_bottom_btn">
				<view class="word" @click="goSub">再次提交</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		formatDate
	} from '@/utils/moment/index.js';
	import {
		pagingMixin
	} from '@/mixins/pagingMixin';
	export default {
		mixins: [pagingMixin],
		data() {
			return {
				formId: null,
				statusObj: {
					0: '无需审核',
					1: '待审核',
					2: '已完成',
				},
				parameter: {},
				detail: {}
			};
		},
		filters: {
			formatTime(val) {
				return formatDate(new Date(val), 'YYYY-MM-DD HH:mm:ss');
			}
		},
		onLoad(options) {
			if (options && options.id) {
				this.formId = Number(options.id)
				this.$initPage();
			}
		},
		onReachBottom() {
			this._load_data()
		},
		methods: {
			$initPage() {
				this._init_data('GetCustomFormValInfoList', {
					pk_id: this.formId
				}, {
					callBack: this.$format
				})
			},
			$format(list) {
				if (!this.parameter.examine && list[0]) {
					this.parameter = JSON.parse(list[0].parameter || '{}')
				}
				return list
			},
			seeDetail(item) {
				this.detail = {
					...item
				}
				this.$linkTo('/package/activity/form/adminCheck/index?isHistory=1')
			},
			goSub() {
				let pages = getCurrentPages();
				let prePage = pages[pages.length - 2].$vm
				prePage.goAgainSub()
				this.uniBack()
			}
		},
	};
</script>
<style>
	page {
		background-color: #F5F5F5;
	}
</style>
<style scoped lang="scss">
	.hist_item {
		padding: 20rpx 30rpx;
		border-top: 2rpx solid #f5f5f5;
		background-color: #fff;

		.top {
			display: flex;
			justify-content: space-between;

			.sign {
				font-size: 24rpx;
				background-color: var(--color);
				color: #fff;
				border-radius: 6rpx;
				padding: 4rpx 10rpx;

				&.success {
					background-color: #13CE66;
				}
			}
		}

		.phone {
			font-size: 26rpx;
			margin-top: 10rpx;
		}


		.sign_tiem {
			font-size: 26rpx;
			margin-top: 6rpx;

			.time {

				color: #999;
			}
		}
	}
</style>
